package org.example;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import java.io.IOException;

/**游戏窗体    jdk提供的窗口
* @date
 */

public class FishlordFrame extends JFrame {
        public static final int WIDTH = 800; //static final 修饰符 表示静态不可变的
        public static final int HEIGHT = 480;

    private  Pool pool;

    /**
     * 构造器中初始化界面
     */

    public FishlordFrame(){

            this.setTitle("can的捕鱼项目");      //设置窗口标题
            this.setSize(WIDTH,HEIGHT);        //设置窗口大小
            this.setLocationRelativeTo(null);
            this.setResizable(false);       //是否可以调整窗口大小
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//是否默认关闭
        try {
            pool = new Pool();
            this.getContentPane().add(pool);
            this.setVisible(true);
            pool.action();
        }catch (IOException e){
            JOptionPane.showMessageDialog(this, "加载资源失败！","应用程序错误",JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
        } catch (Exception e) {
            JOptionPane.showMessageDialog(this, "初始化游戏失败！","应用程序错误",JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
        }
        }

    }

